package work.stream;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class Test {
    public static void main(String[] args) {
        //Arrays.asList将数组转化为列表
        List<Library> ll = Arrays.asList(
                new Library("肖申克的救赎",10000),
                new Library("乡土中国",30),
                new Library("活着",35),
                new Library("论语新注新译",100),
                new Library("经济学原理",55),
                new Library("古文观止",78),
                new Library("孙子兵法",120)
        );

        List<String> overHundredLibraryName = ll.stream()
                .filter(d -> d.getPrice()>=100)
                .sorted((d1,d2) -> (int) (d1.getPrice()-d2.getPrice()))
                .map(d -> d.getName())
                .collect(Collectors.toList());

        for(String name:overHundredLibraryName){
            System.out.println(name);
        }

    }
}
